package com.hnucm.chapter4_1;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;

import com.hnucm.chapter4_1.ui.CircleView;

public class MainActivity extends AppCompatActivity {

    private static final String TAG="MainActivity";
    private CircleView circleView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        circleView=findViewById(R.id.circleView);
    }

    //View已经初始化完成。当Activity的窗口得到和失去焦点时均会被调用此方法。
    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        if(hasFocus){
            int width=circleView.getWidth();
            int height=circleView.getHeight();
            Log.e(TAG, "onWindowFocusChanged: width="+width+"   height="+height);
        }
    }
}